<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style>
			html,
			body {
				margin: 0;
				overflow: hidden;
				width: 100%;
				height: 100%;
			}

			body {
				background: #0cebeb;
				/* fallback for old browsers */
				background: -webkit-linear-gradient(to right, #0cebeb, #20e3b2, #29ffc6);
				/* Chrome 10-25, Safari 5.1-6 */
				background: linear-gradient(to right, #0cebeb, #20e3b2, #29ffc6);
				/* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
				/* uigradients 网站 */
			}
		</style>
	</head>
	<body>
		<canvas id="canvas"></canvas>
		<script>
			const WIDTH = document.documentElement.clientWidth;
			const HEIGHT = document.documentElement.clientHeight;
			
			let ctx = document.getElementById('canvas'),
				content = ctx.getContext('2d'),
				round = [],
				initRoundPopulation = 80;
			ctx.width = WIDTH;
			ctx.height = HEIGHT;

			function box(index, x, y) {
				this.index = index;
				this.x = x;
				this.y = y;
				this.r = Math.random() * 5 + 1;
				var alpha = (Math.floor(Math.random() * 10) + 1) / 10 / 2;
				this.color = "rgba(255,255,255," + alpha + ")";
			}

			box.prototype.draw = function() {
				content.fillStyle = this.color;
				content.shadowBlur = this.r * 2;
				content.beginPath();
				content.arc(this.x, this.y, this.r, 0, 2 * Math.PI, false);
				content.closePath();
				content.fill();
			};

			function animate() {
				content.clearRect(0, 0, WIDTH, HEIGHT);
				for (var i in round) {
					round[i].move();
				}
				requestAnimationFrame(animate)
			}

			box.prototype.move = function() {
				this.y -= 0.15;
				if (this.y <= -10) {
					this.y = HEIGHT + 10;
				}
				this.draw();
			};

			function init() {
				for (var i = 0; i < initRoundPopulation; i++) {
					round[i] = new box(i, Math.random() * WIDTH, Math.random() * HEIGHT);
					round[i].draw();
				}
				animate();
			}
			init();
		
		</script>
	</body>
</html>
